import request from '@/config/axios'

// 仓库 VO
export interface DepotVO {
  name: string // 仓库名称
  address: string // 仓库地址
  warehousing: number // 仓储费
  truckage: number // 搬运费
  type: number // 类型
  sort: string // 排序
  remark: string // 描述
  principal: number // 负责人
  enabled: boolean // 启用
  isDefault: boolean // 是否默认
}

// 仓库 API
export const DepotApi = {
  // 查询仓库分页
  getDepotPage: async (params: any) => {
    return await request.get({ url: `/material/depot/page`, params })
  },

  // 查询仓库详情
  getDepot: async (id: number) => {
    return await request.get({ url: `/material/depot/get?id=` + id })
  },

  // 新增仓库
  createDepot: async (data: DepotVO) => {
    return await request.post({ url: `/material/depot/create`, data })
  },

  // 修改仓库
  updateDepot: async (data: DepotVO) => {
    return await request.put({ url: `/material/depot/update`, data })
  },

  // 删除仓库
  deleteDepot: async (id: number) => {
    return await request.delete({ url: `/material/depot/delete?id=` + id })
  },

  // 导出仓库 Excel
  exportDepot: async (params) => {
    return await request.download({ url: `/material/depot/export-excel`, params })
  },
}